<template>
	<view>
		<view class="order-list">
			<z-paging ref="orderPaging" v-model="orderList" @query="queryList">
				<template #top>
					<app-header color="#fff" :title="headerTitle" />
				</template>
				<view class="comm-container">
					<view class="order-item" v-for="(item,index) in orderList">
						<navigator :url="`/subpages/views/order/detail?id=${item.id}`" hover-class="none">
							<view class="order-header">
								<text>订单号：{{item.orderNo || '无订单号'}}</text>
							</view>
							<view class="order-info">
								<view class="sender-info info-text">
									<view class="name">{{item.sendName}}</view>
									<view class="address">{{item.sendAddressDetail}}</view>
								</view>
								<view class="status-info">
									<template v-if="item.status == 1">
										<view class="status">
											<text>运输中</text>
										</view>
										<image mode="widthFix" src="/subpages/static/images/icon-06.png" class="img" />
									</template>
									<template v-else-if="item.status == 2">
										<view class="status">
											<text>已签收</text>
										</view>
											<image mode="widthFix" src="/subpages/static/images/icon-05.png" class="img" />
									</template>
									<template v-else>
										<view class="status">
											<text>未知</text>
										</view>
											<image mode="widthFix" src="/subpages/static/images/icon-05.png" class="img" />
									</template>
								</view>
								<view class="recipient-info info-text">
									<view class="name">{{item.recName}}</view>
									<view class="address">{{item.recAddressDetail}}</view>
								</view>
							</view>
						</navigator>
					</view>
				</view>
			</z-paging>
		</view>
	</view>
</template>

<script>
	import AppHeader from "@/subpages/components/header.vue"
	import { getOrderListAPI } from "@/api/logistics.js"
	export default {
		components: {
			AppHeader
		},
		data() {
			return {
				headerTitle: "订单列表",
				orderList: []
			}
		},
		methods: {
			async queryList(pageNo, pageSize) {
				const data = await getOrderListAPI();
				this.$refs.orderPaging.complete(data.rows);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.order-item {
		background: #fff;
		margin-bottom: 40rpx;
		border-radius: 20rpx;
		padding: 40rpx;
		box-sizing: border-box;
		.order-header {
			border-bottom: 1px solid #D3D3D3;
			padding-bottom: 20rpx;
			color: #222222;
			font-size: 26rpx;
		}
		.order-info {
			display: flex;
			justify-content: space-between;
			text-align: center;
			align-items: center;
			padding: 30rpx 0;
			.info-text {
				.name {
					font-size: 32rpx;
					margin-bottom: 25rpx;
					font-weight: bold;
				}
				.address {
					color: #989898;
					font-size: 30rpx;
				}
			}
			.status-info {
				.stauts {
					color: #222;
					font-size: 26rpx;
				}
				.img {
					width: 140rpx;
					margin-top: 20rpx;
				}
			}
		}
	}
</style>
